package com.molin.setTest.hashSetTest;

import java.util.HashSet;
import java.util.Iterator;

public class Demo1 {
    public static void main(String[] args) {
        Student student1 = new Student(12, "zhangsan1");
        Student student2 = new Student(13, "zhangsan2");
        Student student3 = new Student(14, "zhangsan3");
        Student student4 = new Student(12, "zhangsan1");
        Student student5 = new Student(13, "zhangsan2");
        Student student6 = new Student(14, "zhangsan3");
        HashSet<Student> studentHashSet=new HashSet<>();
        studentHashSet.add(student1);
        studentHashSet.add(student2);
        studentHashSet.add(student3);
        studentHashSet.add(student4);
        studentHashSet.add(student5);
        studentHashSet.add(student6);

        Iterator iterator=studentHashSet.iterator();
        while (iterator.hasNext()) {
            System.out.println(iterator.next().toString());
        }
    }
}
